﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:local="clr-namespace:FIFP.DashBoard.Views"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"    
    DataContext="{Binding ImportVM,Source={StaticResource ServiceLocator}}"
	x:Class="FIFP.DashBoard.Views.Import"
    mc:Ignorable="d"    
    xmlns:StoryboardManager="clr-namespace:FIFP.DashBoard.ViewModel"
    xmlns:Presentation="clr-namespace:FIFP.Common.Behaviors.CommonEventArgs;assembly=FIFP.Common"
    xmlns:vm="clr-namespace:FIFP.DashBoard.ViewModel"    
    d:DesignHeight="600" d:DesignWidth="1000">

    <UserControl.Resources>
        <ResourceDictionary>
            <Storyboard x:Name="SettingStart" StoryboardManager:StoryboardManager.ID="SettingFlipStart">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="grid1">
                    <EasingDoubleKeyFrame KeyTime="0" Value="1700">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                    <EasingDoubleKeyFrame KeyTime="0:0:1.0" Value="105">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="grid1">
                    <EasingPointKeyFrame KeyTime="0" Value="0.5,0.5"/>
                    <EasingPointKeyFrame KeyTime="0:0:1.0" Value="0.5,0.5"/>
                </PointAnimationUsingKeyFrames>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="grid1">
                    <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                            <HorizontalAlignment>Stretch</HorizontalAlignment>
                        </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>
                    <DiscreteObjectKeyFrame KeyTime="0:0:1.0">
                        <DiscreteObjectKeyFrame.Value>
                            <HorizontalAlignment>Stretch</HorizontalAlignment>
                        </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Name="SettingHide" StoryboardManager:StoryboardManager.ID="SettingFlipHide">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="grid1">
                    <EasingDoubleKeyFrame KeyTime="0" Value="105">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                    <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="2070">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <QuinticEase EasingMode="EaseOut"/>
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Loaded">
                <i:InvokeCommandAction Command="{Binding ImportPageLoadCommand}" 
        							CommandParameter="{Binding ElementName=grdChild}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
        <Grid Margin="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="210"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <ScrollViewer Grid.Column="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Style="{StaticResource ScrollViewerStyle1}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Button Tag="reset" Name="btnReset" IsEnabled="{Binding IsCalButtonEnabled}" Command="{Binding Path=ResetPlansEvent}" CommandParameter="{Binding ElementName=btnReset}" Content="Show the whole plan" Margin="0,5,0,1" Height="28" Style="{StaticResource OverlapButtonStyle}"  Cursor="Hand" VerticalAlignment="Center" />
                    <RadioButton Name="rdFilter" Grid.Row="1" Tag="filter" IsEnabled="{Binding IsFilterButtonEnabled}" Command="{Binding Path=FilterButtonVisibilityCommand}" CommandParameter="{Binding ElementName=rdFilter}" Content="Filter" Margin="0,20,0,1" Height="25" Style="{StaticResource RadioButtonLeftSideStyleMenu}" Cursor="Hand" />
                    <Grid Grid.Row="2" Visibility="{Binding FilterVisibility}">
                        <local:UCFilter x:Name="ucFilter"></local:UCFilter>
                    </Grid>
                    <RadioButton Name="rdUnitFilter" Grid.Row="3" Tag="filtertree"  Visibility="{Binding IsUnitFilterVisibility}" IsEnabled="{Binding IsFilterButtonEnabled}" Command="{Binding Path=FilterButtonVisibilityCommand}" CommandParameter="{Binding ElementName=rdUnitFilter}" Content="Unit Filter" Margin="0,0,0,1" Height="25" Style="{StaticResource RadioButtonLeftSideStyleMenu}" Cursor="Hand"/>
                    <Grid Grid.Row="4" Margin="0,10,0,5" Visibility="{Binding FilterTreeVisibility}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Grid.Row="0" TextWrapping="Wrap" Text="Enter UnitName" Style="{StaticResource SmallHeading}" VerticalAlignment="Top" Margin="0"/>
                        <TextBox Name="txtUnitName" Grid.Row="1" Text="{Binding UnitName, Mode=TwoWay, ValidatesOnNotifyDataErrors=True,NotifyOnValidationError=True, UpdateSourceTrigger=Default}" MaxLength="100" Margin="0" Style="{StaticResource TextBoxStyle1}" TextWrapping="Wrap" Width="205">
                            <i:Interaction.Triggers>
                                <i:EventTrigger  EventName="Loaded">
                                    <i:InvokeCommandAction  Command="{Binding TextBoxLoadCommand}" CommandParameter="{Binding ElementName=txtUnitName}" />
                                </i:EventTrigger>
                                <i:EventTrigger EventName="KeyDown">
                                    <Presentation:InvokeDelegateCommandAction
                                    Command="{Binding Source={StaticResource ServiceLocator},Path=ImportVM.UnitNameKeyDownCommand}"
                                    CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </TextBox>
                        <Button x:Name="btnFilter" Cursor="Hand" Grid.Row="2" Content="Filter" Command="{Binding Path=UnitFilterCommand}" CommandParameter="{Binding ElementName=btnFilter}"  Margin="0,5,0,5" Width="160" Style="{StaticResource ButtonStyleNew}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Grid>
                </Grid>
            </ScrollViewer>

            <Grid Margin="10,0,0,0" Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid Margin="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <!--<ColumnDefinition Width="Auto"/>-->
                    </Grid.ColumnDefinitions>
                    <Button Name="btnImport" Tag="import" Content="Import the original plan" Margin="0,0,30,0" Width="160" Style="{Binding ImportStyle}" VerticalAlignment="Center" Visibility="Collapsed">
                        <i:Interaction.Triggers>
                            <i:EventTrigger  EventName="Click">
                                <i:InvokeCommandAction Command="{Binding SaveCommand}" 
        							CommandParameter="{Binding ElementName=btnImport}"  />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                    <Button Tag="open" Name="btnOpen" Cursor="Hand" Command="{Binding Path=openCommand}" CommandParameter="{Binding ElementName=btnOpen}" 
                            Margin="0,0,10,0" Grid.Column="0" Style="{StaticResource ButtonStyleTransparent}" VerticalAlignment="Center">
                        <Button.Content>
                            <StackPanel>
                                <Image Margin="0" Source="/FIFP.DashBoard;component/Images/open.png" 
                                       Stretch="Fill" Height="40" RenderTransformOrigin="0.5,0.5" Width="40">
                                </Image>
                            </StackPanel>
                        </Button.Content>

                        <telerik:RadContextMenu.ContextMenu>
                            <telerik:RadContextMenu EventName="Click" ItemsSource="{Binding OpenMenuItems}" ItemContainerStyle="{StaticResource RadMenuItemStyle}" Style="{StaticResource RadContextMenuStyle}">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="ItemClick">
                                        <Presentation:InvokeDelegateCommandAction
                                            Command="{Binding Source={StaticResource ServiceLocator},Path=ImportVM.OpenPlansCommand}"
                                            CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                                <telerik:RadContextMenu.ItemTemplate>
                                    <telerik:HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
                                        <TextBlock Text="{Binding ScenarioName}" />
                                    </telerik:HierarchicalDataTemplate>
                                </telerik:RadContextMenu.ItemTemplate>
                            </telerik:RadContextMenu>
                        </telerik:RadContextMenu.ContextMenu>
                    </Button>

                    <Button Tag="save" Cursor="Hand" Name="btnSave" IsHitTestVisible="{Binding IsCalButtonEnabled}" Command="{Binding Path=saveCommand}" CommandParameter="{Binding ElementName=btnSave}" 
                            Margin="0,0,20,0" Grid.Column="1" Style="{StaticResource ButtonStyleTransparent}" VerticalAlignment="Center">
                        <Button.Content>
                            <StackPanel>
                                <Image Margin="0" Source="/FIFP.DashBoard;component/Images/save.png" 
                                       Stretch="Fill" Height="40" RenderTransformOrigin="0.5,0.5" Width="40">
                                </Image>
                            </StackPanel>
                        </Button.Content>
                        <telerik:RadContextMenu.ContextMenu>
                            <telerik:RadContextMenu EventName="Click" ItemsSource="{Binding SaveMenuItems}" ItemContainerStyle="{StaticResource RadMenuItemStyle}" Style="{StaticResource RadContextMenuStyle}">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="ItemClick">
                                        <Presentation:InvokeDelegateCommandAction
                                            Command="{Binding Source={StaticResource ServiceLocator},Path=ImportVM.SavePlansCommand}"
                                            CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                                <telerik:RadContextMenu.ItemTemplate>
                                    <telerik:HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
                                        <TextBlock Text="{Binding ScenarioName}" />
                                    </telerik:HierarchicalDataTemplate>
                                </telerik:RadContextMenu.ItemTemplate>
                            </telerik:RadContextMenu>
                        </telerik:RadContextMenu.ContextMenu>
                    </Button>

                    <Button Tag="add" Name="btnAdd" Cursor="Hand" IsEnabled="{Binding IsAddActivityButtonEnabled}" Command="{Binding Path=AddNewActivityEvent}" CommandParameter="{Binding ElementName=btnAdd}" Content="Add Activity" Margin="0,0,30,0" Width="130" Height="28" Style="{StaticResource OverlapButtonStyle}" Grid.Column="2" VerticalAlignment="Center" />
                    <Button Tag="calculate" Name="btnCalculate" Cursor="Hand"  IsEnabled="{Binding IsCalButtonEnabled}" Command="{Binding Path=CalculateCommand}" CommandParameter="{Binding ElementName=btnCalculate}"  Content="Calculate EC" Margin="0,0,30,0" Height="28"  Width="130" Style="{StaticResource OverlapButtonStyle}" Grid.Column="3" VerticalAlignment="Center" />
                    <Button Tag="calculateMax" Cursor="Hand" Name="btnCalculateMax" IsEnabled="{Binding IsInitLoadCompleted}" Command="{Binding Path=CalculateMaxCommand}" CommandParameter="{Binding ElementName=btnCalculateMax}"  Content="Calculate 100% Efficient Capacity" Margin="0,0,30,0" Height="28"  Width="270" Style="{StaticResource OverlapButtonStyle}" Grid.Column="4" VerticalAlignment="Center" />
                    <Button Tag="undo" Cursor="Hand" Name="btnUndo" IsEnabled="{Binding IsCalButtonEnabled}" Command="{Binding Path=UndoCommand}" CommandParameter="{Binding ElementName=btnUndo}"  Content="Undo" Margin="0,0,30,0" Height="28"  Width="100" Style="{StaticResource OverlapButtonStyle}" Grid.Column="5" VerticalAlignment="Center" />
                    <StackPanel Orientation="Horizontal" Margin="0" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="6">
                        <!--<Button Tag="reset" Name="btnReset" HorizontalAlignment="Right" IsEnabled="{Binding IsCalButtonEnabled}" Command="{Binding Path=ResetPlansEvent}" CommandParameter="{Binding ElementName=btnReset}" Content="Show All Plans" Margin="0" Width="130" Height="28" Style="{StaticResource OverlapButtonStyle}"  Cursor="Hand" VerticalAlignment="Center" />-->
                        <HyperlinkButton x:Name="lnkSettings" Visibility="{Binding CalculateMaxVisibility}" IsEnabled="{Binding IsInitLoadCompleted}" Tag="Overview" Content="Settings" VerticalAlignment="Center" Cursor="Hand" Margin="10,0,0,0" Style="{StaticResource HyperlinkbuttonFontStyleNormalNew}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger  EventName="Click">
                                    <i:InvokeCommandAction  Command="{Binding SettingsCommand}" CommandParameter="{Binding ElementName=lnkSettings}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </HyperlinkButton>
                    </StackPanel>

                </Grid>
                <Path Data="M25.666672,37 L204.34454,37" Margin="0,10,0,0" Grid.Row="1" Stretch="Fill" StrokeThickness="1" UseLayoutRounding="False" VerticalAlignment="Top" Height="1" Stroke="{StaticResource LineColor}" />
                <Grid Margin="0,10,0,0" Grid.Row="2">
                    <local:UCAppointment_New x:Name="ucAppointment" />
                </Grid>
            </Grid>
            <Grid Margin="0" Grid.Column="1"> 
                <Grid x:Name="grid1" Margin="0" RenderTransformOrigin="0.5,0.5">
                    <Grid.RenderTransform>
                        <CompositeTransform TranslateX="2070"/>
                    </Grid.RenderTransform>
                    <local:Settings x:Name="SettingsNew" RenderTransformOrigin="0.5,0.5">
                        <local:Settings.RenderTransform>
                            <CompositeTransform />
                        </local:Settings.RenderTransform>
                    </local:Settings>
                </Grid>
            </Grid>
        </Grid>
    </Grid>

</UserControl>
